a = [[1,4],[3,4],[2,3],[3,4],[1,2]]
a.sort(key=lambda x: x[1])
end = a[0][1]
ans = 1
print(a)
for i in range(1, len(a)-1):
    if end <= a[i][0]:
        ans += 1

print(ans)

